from tkinter import *

root = Tk()

'''
Label(root,text='red',bg='red',fg='white').pack(fill=X)      #pack依次纵向排列
Label(root,text='green',bg='green',fg='black').pack(fill=X)
Label(root,text='blue',bg='blue',fg='white').pack(fill=X)
'''
Label(root,text='red',bg='red',fg='white').pack(side=LEFT)   #pack依次横向排列
Label(root,text='green',bg='green',fg='black').pack(side=LEFT)
Label(root,text='blue',bg='blue',fg='white').pack(side=LEFT)

mainloop()
